#version 330 core
layout(location = 0)in vec3 vertPos;
layout(location = 1)in vec3 vertColor;
layout(location = 2)in vec3 vertNormal;

out vec3 color;
out vec4 vEyePos;
out vec3 vEyeNormal;
out vec3 eyeLightDir;

struct point_light
{
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec3 position;
};

uniform point_light plight;

uniform mat4 mvMatrix;
uniform mat4 projMatrix;
uniform mat3 normalMatrix;
uniform bool hasMaterial;
uniform bool partColor;
uniform vec3 pureColor;

void main()
{
    vEyePos = mvMatrix*vec4(vertPos,1.0);
    eyeLightDir = plight.position - vEyePos.xyz;
    vEyeNormal = normalMatrix*vertNormal;

    if(!hasMaterial){
        if(partColor){
            color = vertColor;
        }else{
            color = pureColor;
        }
    }

    gl_Position = projMatrix*mvMatrix*vec4(vertPos,1.0);
}
